#pragma once
#include <string>
#include <unordered_map>

struct MarketData {
	char trading_day[10];
	char update_time[10];
	int millisecond;
	double last_price = 0;
	double volume = 0;
	double amount = 0;

	double upper_limit = 0;
	double lower_limit = 0;

	double ask_price = 0;
	double bid_price = 0;

	double open_price = 0;
	double high_price = 0;
	double low_price = 0;
	double close_price = 0;

	double buy_volume = 0;
	double buy_amount = 0;
	double sell_volume = 0;
	double sell_amount = 0;
	int trade_count = 0;
};

class PolicyContainer;

class Policy {
public:
	using ConfigMap = std::unordered_map<std::string, std::string>;
	Policy(const ConfigMap& c) : config_map(c) {}
	void OnMarketData(const MarketData* md);
	void SwitchDay(const std::string trading_day);

private:
	friend class PolicyContainer;
	int current_position = 0;
	int target_position = 0;
	std::string remark;
	const ConfigMap config_map;
};
